package com.shxy.api.bean.news;


import com.shxy.api.bean.user.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;

/**
 * 新闻实体类
 */
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "tb_news")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class NewsBean {
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @Column(length = 32)
    private String id;                  // 编号
    @Column(nullable = false)
    private String title;               // 标题
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(nullable = false, columnDefinition = "text")
    private String content;             // 内容，懒加载
    @ManyToOne
    @JoinColumn(name = "author_id", nullable = false)
    private UserInfo author;            // 作者
    private long updateTime;            // 更新时间
    private boolean cataloged = true;   // 分类标记
}
